<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main"/>
  <title>Create Entry</title>
  <script type="text/javascript" src="${createLinkTo(dir: 'js/jquery', file: 'jquery-1.3.2.min.js')}"></script>
  <g:render template="popupList"/>
</head>
<body>
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}">Home</a></span>
  <span class="menuButton"><g:link class="list" action="list">Entry List</g:link></span>
</div>
<div class="body">
  <div id="stageList" class="popupList hidden">
    <div class="preHeader"></div>

    <div class="header"></div>
    <div class="content"></div>
    <div class="footer"><input type="button" value="关闭窗口" class="btnGrey" style="padding:3px 5px;margin:3px 0 8px 0" onClick="$('#stageList').hide()"></div>
  </div>
  
  <h1>Create Entry</h1>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <g:hasErrors bean="${entryInstance}">
    <div class="errors">
      <g:renderErrors bean="${entryInstance}" as="list"/>
    </div>
  </g:hasErrors>
  <g:form action="save" method="post">
    <div class="dialog">
      <table>
        <tbody>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="title">Title:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'title', 'errors')}">
            <input type="text" id="title" name="title" value="${fieldValue(bean: entryInstance, field: 'title')}"/>
          </td>
        </tr>


        <tr class="prop">
          <td valign="top" class="name">
            <label for="content">Content:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'content', 'errors')}">
            <fckeditor:editor
                name="content"
                width="100%"
                height="400"
                toolbar="Default"
                fileBrowser="default">
            ${entryInstance.content}
            </fckeditor:editor>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="contentType">Content Type:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'contentType', 'errors')}">
            <input type="text" id="contentType" name="contentType" value="${fieldValue(bean: entryInstance, field: 'contentType')}"/>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="description">Description:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'description', 'errors')}">
            <input type="text" id="description" name="description" value="${fieldValue(bean: entryInstance, field: 'description')}"/>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="tagNames">Tag Names:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'tagNames', 'errors')}">
            <input type="text" id="tagNames" name="tagNames" value="${fieldValue(bean: entryInstance, field: 'tagNames')}"/>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="source">Source:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'source', 'errors')}">
            <input type="text" id="source" name="source" value="${fieldValue(bean: entryInstance, field: 'source')}"/>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label>Catalog:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'catalog', 'errors')}">
            <g:select optionKey="id" from="${Catalog.list()}" name="catalog.id" value="${entryInstance?.catalog?.id}" noSelection="['null':'']"></g:select>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="hits">Hits:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'hits', 'errors')}">
            <input type="text" id="hits" name="hits" value="${fieldValue(bean: entryInstance, field: 'hits')}"/>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="recommend">Recommend:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'recommend', 'errors')}">
            <input type="text" id="recommend" name="recommend" value="${fieldValue(bean: entryInstance, field: 'recommend')}"/>
          </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="stage">Stage:</label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: entryInstance, field: 'stage', 'errors')}">
            <input class="stagePopup" type="text" id="stage" name="stage" value="${fieldValue(bean: entryInstance, field: 'stage')}"/>
            <span id="stageName"></span>
          </td>
        </tr>

        </tbody>
      </table>
    </div>
    <div class="buttons">
      <span class="button"><input class="save" type="submit" value="Create"/></span>
    </div>
  </g:form>
</div>
</body>
</html>
